package com.github.kassadin.kotlinandroid

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.LinearLayoutManager
import android.util.Log
import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.custom.async
import org.jetbrains.anko.uiThread

public class MainActivity : AppCompatActivity() {
    var retData: RetData? = null


    init {
        // 构造函数的函数体
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        //        tv.text = "hehe"

        var adapter = ForecastListAdapter(this, retData)
        forecast_list.layoutManager = LinearLayoutManager(this@MainActivity)
        forecast_list.adapter = adapter
        async() {
            val resp: RecentWeathersResp = WeatherRequest(101010100.toString()).execute()
            uiThread {
                Log.d("main", resp.toString())
                adapter.retData = resp.retData
                adapter.notifyDataSetChanged()
            }
        }
    }


}
